package org.example.book.entity;

import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

public class MyUserDetails implements UserDetails {
    @Getter
    private User user;
    private String authorities;

    public void setUser(User user) {
        this.user = user;
    }

    public void setAuthorities(String authorities) {
        this.authorities = authorities;
    }

    public MyUserDetails(User user, String authorities) {
        this.user = user;
        this.authorities=authorities;
    }



    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return List.of();
    }

    @Override
    public String getPassword() {
        return user.getPassword();
    }

    @Override
    public String getUsername() {
        return user.getUsername();
    }
}
